package com.example.day02;

public class HomeWork {

    //计算1001*1001 螺旋上的值
    public static void main(String[] args) {
        System.out.println(test1());
    }
    public  static  long test1(){

        //1. 转了500圈
        // 每一圈的边角值
        //每圈的等差是2 , 4 , 6 ,...
        int  n=2;   //起始 等差是2，循环圈数
        int  i=1;
        long total=1L;
        while (n<1001){
            i=n+i;  //1+2=3
            total=total+i; //1+3

            i=n+i;       //5
            total=total+i; //1+3+5

            i=n+i;       //7
            total=total+i; //1+3+5 7

            i=n+i;       //9
            total=total+i; //1+3+5 7 9

            n=n+2;
        }
        return  total;
    }
}
